<?php

namespace support\Backend;

use support\Response;
/**
 * controller 基类
 */
class BackendController
{

    /**
     * 用户登录id
     * @var int
     */
    protected int $userId;

    /**
     * 逻辑类
     * @var BackendLogic
     */
    protected BackendLogic $logic;


    public function __construct()
    {
        $this->userId = \Tinywan\Jwt\JwtToken::getCurrentId();
    }

    /**
     * 列表
     * @return Response
     */
    public function index(): Response
    {
        return success($this->logic->getList());
    }

    /**
     * 详情
     * @return Response
     */
    public function info(): Response
    {
        return success($this->logic->info());
    }

    /**
     * 新增或者编辑
     * @return Response
     */
    public function edit(): Response
    {
        return success($this->logic->edit());
    }


    /**
     * 删除
     * @return Response
     */
    public function delete(): Response
    {
        return success($this->logic->delete());
    }

    /**
     * 状态
     * @return
     */
    public function status(): Response
    {
        return success($this->logic->status());
    }

    /**
     * 导出
     * @return Response
     */
    public function exportExcel(): Response
    {
        return success($this->logic->exportExcel());
    }
}